from user import *
from net.conn import *
from protocol.IPacket import *

class userVec():

	def __init__(self):
		self.users = ()

	def addUser(self, user):
		self.users.append(user)

	def delUser(self, user):
		for i in self.users:
			if(i.uid == user.uid):
				del self.users(i)

	def loop(self):
		while(1):
			for user in self.users:
				conn = user.conn
				if conn:
					conn.__checkPacket()
					packetNum = conn.getPacketNum()
					if packetNum > 0:
						while(1):
							packet = conn.getPacket()
							if packet :
								user.processAction(packet)
							else break
			time.sleep(0.5)
			print "loop"


uv = userVec()




